<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        let books = `
          [
            {
                "books_id":1,
                "book_name":"childlive",
                "book_price":21,
                "book_publish_data":["author","wo"],
                "book_w":true,
                "book_2":{"ds":1}
            }
            ,{
                "books_id":2,
                "book_name":"manlive",
                "book_price":33,
                "book_publish_data":["authors","wos"],
                "book_w":false,
                "book_2":{"dss":2}
            }
        ]
        `
        let b2 = `{"book":"sb"}`
        function toJson(str){
            var json = (new Function('return ' + str))();
            return json;
        }
        //添加小括号，把代码转换为对象，此时代码是json对象
        let bookjson01 = eval("(" + books + ")")
        let bookjson02 = JSON.parse(books)
        var bookjson03 = toJson(books)
        console.log( bookjson01)
        console.log( bookjson02)
        console.log( bookjson03)
        console.log(JSON.stringify(bookjson01));
    </script>
</head>
<body>

</body>
</html>